def hexToDecimal(hex):
    decimalValue = 0
    for ch in hex:
        if 'A' <= ch <= 'F' or '0' <= ch <= '9':
            decimalValue = decimalValue * 16 + hexCharToDecimal(ch)
        else:
            return None
    return decimalValue

def hexCharToDecimal(ch):
    if 'A' <= ch <= 'F':
        return 10 + ord(ch) - ord('A')
    else:
        return ord(ch) - ord('0')

def main():
    hex = input("请输入一个数字：").strip()

    decimal = hexToDecimal(hex.upper())
    if decimal == None:
        print("错误的数字")
    else:
        print("这个的数字所对应的十进制数为",decimal)

main()